﻿Public Class Form1
    Private mobjoutlookBar As OutlookBar

    Public Sub New()

        ' 此调用是设计器所必需的。
        InitializeComponent()

        ' 在 InitializeComponent() 调用之后添加任何初始化。


        Dim outlookBar As OutlookBar = New OutlookBar
        mobjoutlookBar = outlookBar
        outlookBar.Location = New Point(0, 0)
        outlookBar.Size = New Size(300, Me.ClientSize.Height)
        outlookBar.BorderStyle = BorderStyle.FixedSingle
        Controls.Add(outlookBar)
        outlookBar.Initialize()

        Dim iconPanel1 As IconPanel = New IconPanel()
        Dim iconPanel2 As IconPanel = New IconPanel()
        Dim iconPanel3 As IconPanel = New IconPanel()
        outlookBar.AddBand("Outlook Shortcuts", iconPanel1)
        outlookBar.AddBand("My Shortcuts", iconPanel2)
        outlookBar.AddBand("Other Shortcuts", iconPanel3)

        iconPanel1.AddIcon("Outlook Today", Image.FromFile("img1.ico"), New EventHandler(AddressOf PanelEvent))
        iconPanel1.AddIcon("Calendar", Image.FromFile("img2.ico"), New EventHandler(AddressOf PanelEvent))
        iconPanel1.AddIcon("Contacts", Image.FromFile("img3.ico"), New EventHandler(AddressOf PanelEvent))
        iconPanel1.AddIcon("Tasks>>>>>>>>>>>>>>Tasks", Image.FromFile("img4.ico"), New EventHandler(AddressOf PanelEvent))
        iconPanel1.AddIcon("Outlook Today1", Image.FromFile("img1.ico"), New EventHandler(AddressOf PanelEvent))
        iconPanel1.AddIcon("Calendar1", Image.FromFile("img2.ico"), New EventHandler(AddressOf PanelEvent))
        iconPanel1.AddIcon("Contacts1", Image.FromFile("img3.ico"), New EventHandler(AddressOf PanelEvent))
        iconPanel1.AddIcon("Tasks>>>>>>>>>>>>>>Tasks1", Image.FromFile("img4.ico"), New EventHandler(AddressOf PanelEvent))
        iconPanel1.AddIcon("T>>>>>>>>>>>>>>T", Image.FromFile("img5.bmp"), New EventHandler(AddressOf PanelEvent))
        outlookBar.SelectBand(0)
    End Sub

    Public Sub PanelEvent(ByVal sender As Object, ByVal e As EventArgs)
        MsgBox(CType(CType(sender, Control).Tag, PanelIcon).Index.ToString)
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        mobjoutlookBar.Size = New Size(150, Me.ClientSize.Height)
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        mobjoutlookBar.Size = New Size(300, Me.ClientSize.Height)
    End Sub

End Class
